﻿<UserControl 
  x:Class="ContentControl3D_Demo.Samples.ZoomDestinationSample"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:thriple="http://thriple.codeplex.com/"
  >
  <UserControl.Resources>
    <DataTemplate x:Key="FrontAndBackTemplate">
      <Border 
        Background="#22FF0000" 
        BorderBrush="#44000000" 
        BorderThickness="6"    
        Padding="2"
        >
        <Image Source="{Binding}" Stretch="Uniform" MaxWidth="400" MaxHeight="600" />
      </Border>
    </DataTemplate>
  </UserControl.Resources>
  
  <DockPanel>
    <DockPanel.Background>
      <ImageBrush ImageSource="Images/Party.jpg" Opacity="0.75" />
    </DockPanel.Background>

    <Border 
      DockPanel.Dock="Bottom" 
      Background="#AA000000" 
      BorderBrush="Gray" 
      BorderThickness="2,2,2,0" 
      CornerRadius="6,6,0,0" 
      Margin="1,0"
      Padding="4"
      >
      <StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
        <TextBlock Foreground="White" Text="Camera Zoom Destination: " VerticalAlignment="Center" />
        <TextBox 
          FontFamily="Courier New" 
          FontSize="14"
          Margin="4,0,6,0"
          Text="{Binding ElementName=cntCtrl3D, Path=CameraZoomDestination, UpdateSourceTrigger=PropertyChanged, ValidatesOnExceptions=True}" 
          ToolTip="Enter a Point3D value here, of the form X,Y,Z"
          Width="120"  
          >
          <TextBox.Style>
            <Style TargetType="{x:Type TextBox}">
              <Style.Triggers>
                <Trigger Property="Validation.HasError" Value="True">
                  <Setter Property="Foreground" Value="Red" />
                </Trigger>
              </Style.Triggers>
            </Style>
          </TextBox.Style>
        </TextBox>
        <Button
          Command="thriple:ContentControl3D.RotateCommand" 
          CommandTarget="{Binding ElementName=cntCtrl3D}"
          Content="Flip"  
          IsDefault="True"
          Width="80"
          />
      </StackPanel>
    </Border>
    
    <thriple:ContentControl3D 
      x:Name="cntCtrl3D" 
      BackContent="Images/SexyWoman.jpg"
      BackContentTemplate="{StaticResource FrontAndBackTemplate}"
      BorderBrush="#88000000"
      BorderThickness="4"
      Content="Images/Grant.jpg" 
      ContentTemplate="{StaticResource FrontAndBackTemplate}"
      MaxWidth="575" MaxHeight="575"
      />
  </DockPanel>
</UserControl>